<template>
    <div class="person">
        <h1>监视：情况一</h1>
        <h1>当前求和为：{{ sum }}</h1>  <!-- 此处不用.value -->
        <button @click="Add">sum+1</button>
    </div>
</template>


<script lang="ts" setup name="Person">
    import {ref,watch} from "vue"
    //数据
    let sum = ref(0)
    //方法
    function Add(){
        sum.value += 1
    }
    
    const stopWatch = watch(sum,(newValue,oldValue)=>{
        console.log(newValue,oldValue)
        }
    )
    
</script>

<style scoped>
    .person{
        background-color: skyblue;
        box-shadow: 0 0 10px;
        border-radius: 10px;
        padding: 20px;
    }
    button{
        margin: 0 5px;
    }
</style>